package com.example.hangzhou.welbeing.mytestdemoapp.factory;

import android.support.v4.app.Fragment;

import com.example.hangzhou.welbeing.mytestdemoapp.fragment.GuideFigureOneFragment;
import com.example.hangzhou.welbeing.mytestdemoapp.fragment.GuideFigureThreedFragment;
import com.example.hangzhou.welbeing.mytestdemoapp.fragment.GuideFigureTwoFragment;

import java.util.HashMap;

/**
 * 杭州惟君医疗科技有限公司10
 * Created by 20433 on 2018/5/4
 *
 * @desc 东风山河绿，春已不折柳，繁花看不尽，处处惹人留
 * @desc 佛祖镇楼，bug辟容易
 */

public class GuideFigureFragmentFactory {
    private static final int GUIDE_FIGURE_ONE = 0; //Home page
    private static final int GUIDE_FIGURE_TWO = 1;  //circle
    private static final int GUIDE_FIGURE_THREED = 2;
    private static HashMap<Integer, Fragment> mapAll = new HashMap();

    public static Fragment CreateCircleObject(int position) {
        Fragment fragment = mapAll.get(position);
        if (fragment == null) {
            switch (position) {
                case GUIDE_FIGURE_ONE:
                    fragment = new GuideFigureOneFragment();
                    break;
                case GUIDE_FIGURE_TWO:
                    fragment = new GuideFigureTwoFragment();
                    break;
                case GUIDE_FIGURE_THREED:
                    fragment = new GuideFigureThreedFragment();
                    break;
            }
            mapAll.put(position, fragment);
            return fragment;
        }
        return fragment;
    }
}
